<template>
  <div>
    <headerComponent></headerComponent>
    <div style="width: 1200px;margin: 0 auto;padding-bottom: 100px">
      <el-card>
        <el-page-header @back="goBack" content=""></el-page-header>
      </el-card>
      <el-card>
        <div class="register">
          <RegistertionAgreement v-if="!isRegister" @toRegister="toRegister"></RegistertionAgreement>
          <!--    请确认您所报名的机构名称：XXX  -->
          <div v-if="isRegister" class="registerFormDiv">
            <el-form
                    label-position="top"
                    :rules="rules"
                    ref="registerForm"
                    :model="registerForm"
                    label-width="80px"
            >
              <div>
                <div>
                  <!--                  <el-form-item :required="true"-->
                  <!--                                :label="!orgLock ? '机构代码（ 提示：请填写机构代码并确认培训机构 ）':`机构代码（ 提示：*您报读的机构名称为【${org_name}】）`"-->
                  <!--                                label-width="400px">-->
                  <el-form-item :required="true"
                                label-width="400px">
                    <p><span style="color: #F56C6C;margin-right: 4px">*</span>
                      <span v-if="!orgLock">机构代码（ 提示：请填写机构代码并确认培训机构 ）</span>
                      <span v-else>机构代码（ 提示：*您报读的机构名称为【<span style="color: dodgerblue">{{org_name}}</span>】）</span>
                    </p>
                    <div style="display: flex">
                      <el-input
                              size="small"
                              style="width: 160px"
                              :disabled="orgLock"
                              v-model="registerForm.org_code"
                      ></el-input>
                      <div>
                        <el-button
                                v-if="!orgLock"
                                size="small"
                                :disabled="orgLock"
                                style="margin-left: 20px"
                                @click="getOrg"
                        >确定
                        </el-button
                        >
                      </div>
                    </div>
                  </el-form-item>
                </div>
              </div>
              <div v-show="course_isShow">
                <el-row :gutter="20">
                  <el-col :span="8">
                    <el-form-item prop="course_id" label="您报读的级别">
                      <el-select
                              style="width: 100%;"
                              size="small"
                              v-model="registerForm.course_id"
                      >
                        <el-option
                                v-for="item in courseList"
                                :key="item.id"
                                :label="item.name"
                                :value="item.id"
                        ></el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item prop="name" label="学员姓名">
                      <el-input
                              size="small"
                              :disabled="true"
                              v-model="registerForm.name"
                      ></el-input>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20">


                  <el-col :span="8">
                    <el-form-item prop="last_py" label="姓拼音">
                      <el-input
                              onblur="this.value=this.value.toUpperCase()"
                              size="small"
                              v-model="registerForm.last_py"
                      ></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item prop="first_py" label="名拼音">
                      <el-input
                              onblur="this.value=this.value.toUpperCase()"
                              size="small"
                              v-model="registerForm.first_py"
                      ></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item :required="true" label="性别">
                      <el-radio-group
                              :disabled="true"
                              v-model="registerForm.gender"
                      >
                        <el-radio :label="'m'">男</el-radio>
                        <el-radio :label="'f'">女</el-radio>
                      </el-radio-group>
                    </el-form-item>
                  </el-col>
                </el-row>

                <el-row :gutter="20">
                  <el-col :span="8">
                    <el-form-item prop="card_type" label="证件类型">
                      <el-select
                              style="width: 100%;"
                              size="small"
                              :disabled="true"
                              v-model="registerForm.card_type"
                              placeholder="请选择证件类型"
                      >
                        <el-option
                                v-for="item in cardOptions"
                                :key="item.id"
                                :label="item.name"
                                :value="item.id"
                        ></el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item prop="card_id" label="证件号码">
                      <el-input
                              size="small"
                              :disabled="true"
                              v-model="registerForm.card_id"
                      ></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item prop="birthday" label="出生日期">
                      <el-date-picker
                              style="width: 100%"
                              size="small"
                              :disabled="true"
                              format="yyyy 年 MM 月 dd 日"
                              value-format="yyyy-MM-dd"
                              placeholder="选择日期"
                              v-model="registerForm.birthday"

                      ></el-date-picker>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="8">
                    <el-form-item prop="hig_edu" label="最高学历">
                      <el-select
                              style="width: 100%"
                              size="small"
                              v-model="registerForm.hig_edu"
                              placeholder="最高学历"
                      >
                        <el-option
                                v-for="item in hig_eduList"
                                :key="item.id"
                                :label="item.value"
                                :value="item.value"
                        >
                        </el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item prop="major" label="相关专业">
                      <el-select
                              style="width: 100%"
                              size="small"
                              v-model="registerForm.major"
                              placeholder="相关专业"
                      >
                        <el-option label="人力资源管理" value="人力资源管理"></el-option>
                        <el-option label="工商管理" value="工商管理"></el-option>
                        <el-option label="行政管理" value="行政管理"></el-option>
                        <el-option label="会计" value="会计"></el-option>
                        <el-option label="财政、税务" value="财政、税务"></el-option>
                        <el-option label="财务管理" value="财务管理"></el-option>
                        <el-option label="其他" value="其他"></el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col v-if="registerForm.hig_edu && !(registerForm.hig_edu.includes('在读'))" :span="8">
                    <el-form-item prop="grad_time" label="毕业年份:">
                      <el-date-picker
                              size="small"
                              format="yyyy 年 MM 月"
                              type="month"
                              value-format="yyyy-MM-dd"
                              placeholder="选择日期"
                              v-model="registerForm.grad_time"
                              style="width: 100%"
                      ></el-date-picker>
                    </el-form-item>
                  </el-col>

                </el-row>
                <el-row :gutter="20">
                  <el-col :span="10">
                    <el-form-item prop="com_name" label="单位名称">
                      <el-input
                              style="width: 320px; margin-right: 20px"
                              size="small"
                              v-model="registerForm.com_name"
                              placeholder="没有工作填写 “无” "
                      ></el-input>
                    </el-form-item>
                  </el-col>

                  <el-col :span="14">
                    <el-form-item prop="province" label="工作区域">
                      <el-cascader
                              style="width: 420px;"
                              size="small"
                              :options="areaOptions"
                              v-model="selectedOptions"
                              @change="addressChange"
                      >
                      </el-cascader>
                    </el-form-item>
                  </el-col>
                </el-row>

                <el-row :gutter="20">
                  <el-col :span="10">
                    <el-form-item prop="com_type" label="单位类型">
                      <el-select
                              style="width: 320px; margin-right: 20px"
                              size="small"
                              v-model="registerForm.com_type"
                              placeholder="请选择单位类型"
                      >
                        <el-option
                                v-for="item in com_typeList"
                                :key="item.value"
                                :label="item.name"
                                :value="item.value"
                        ></el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="14">
                    <el-form-item prop="work_duty" label="职务">
                      <el-select
                              style="width: 420px"
                              size="small"
                              v-model="registerForm.work_duty"
                              placeholder="请选择职务"
                      >
                        <el-option
                                v-for="item in work_dutyList"
                                :key="item.id"
                                :label="item.value.split('#')[0]"
                                :value="item.value"
                        >
                        </el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>

                </el-row>
                <el-row :gutter="20">
                  <el-col :span="10">
                    <el-form-item prop="ind_type" label="行业类型">
                      <el-select
                              style="width: 320px; margin-right: 20px"
                              size="small"
                              v-model="registerForm.ind_type"
                              placeholder="请选择行业类型"
                      >
                        <el-option
                                v-for="item in ind_typeList"
                                :key="item.value"
                                :label="item.name"
                                :value="item.value"
                        >
                        </el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="14">
                    <el-form-item prop="cert" label="相关资质或证书">
                      <el-select
                              size="small"
                              style="width: 420px;"
                              v-model="registerForm.cert"
                              placeholder="请选择"
                      >
                        <el-option
                                v-for="item in certDisplayOptions"
                                :key="item.id"
                                :label="item.value"
                                :value="item.value"
                        >
                        </el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>


                </el-row>
                <el-row :gutter="20">
                  <el-col :span="10">
                    <el-form-item prop="email" label="电子邮箱">
                      <el-input
                              style="width: 320px; margin-right: 20px"
                              size="small"
                              v-model="registerForm.email"
                      ></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="14">
                    <el-form-item prop="work_age" label-width="auto" label="从事薪酬管理（含薪税服务）工作年限（含实习经历）">
                      <el-input
                              oninput="value=value.replace(/[^0-9.]/g,'')"
                              size="small"
                              type="number"
                              v-model="registerForm.work_age"
                              style="width:420px"
                      ></el-input>
                    </el-form-item>
                  </el-col>
                </el-row>

                <el-row :gutter="20">
                  <el-col :span="10">
                    <el-form-item prop="phone" label="手机号码">
                      <el-input
                              size="small"
                              :disabled="true"
                              v-model="registerForm.phone"
                      ></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="14">
                    <el-form-item prop="msg_code" label="短信验证码">
                      <div style="display: flex; align-items: center">
                        <el-input
                                style="width: 150px"
                                size="small"
                                v-model="registerForm.msg_code"
                        ></el-input>
                        <div>
                          <el-button
                                  :disabled="isDisabled"
                                  size="small"
                                  style="font-size: unset; margin-left: 10px"
                                  @click.nactive="codeHandle"
                          >
                            <tencent-captcha
                                    ref="captcha"
                                    :phone="registerForm.phone"
                                    scene="1"
                            ></tencent-captcha>
                          </el-button>
                        </div>
                      </div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col>
                    <el-checkbox style="padding: 20px 0" size="small" v-model="isRegisterPass"><span
                            style="font-size: 12px;"
                    >本人承诺在申请国际薪税师报名时所提供的个人信息及材料真实、合法、有效，否则将承担一切责任及后果。</span></el-checkbox>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col>
                    <el-form-item>
                      <el-button
                              size="small"
                              type="primary"
                              @click="submitForm('registerForm')"
                      >提交
                      </el-button
                      >
                    </el-form-item>
                  </el-col>
                </el-row>
              </div>
            </el-form>
          </div>
        </div>
      </el-card>
    </div>
    <footerComponent></footerComponent>
  </div>
</template>

<script>
  import RegistertionAgreement from '@/components/RegistrationAgreement/index'
  import headerComponent from '@/components/headerComponent'
  import footerComponent from '@/components/footerComponent'
  import TencentCaptcha from "@/components/TencentCaptcha/TencentCaptcha";
  import {areaData, textToCode, codeToText} from "@/utils/JdAreaData/areaData";
  import {get_person_cert_info, getOrg, profile, sign_up} from "@/request/api";
  import {cert_list, work_duty_list,ind_typeList,com_typeList,hig_eduList} from "../../../assets/staticList";
  import certFactor from "../../../utils/certFactor";
  import {getOrg2} from "../../../request/api";
  import {flagFilter} from "@/utils/flag/flagFilter";

  export default {
    name: "index",
    props: {},
    data() {
      var card_id_rule = (rule, value, callback) => {
        if (this.registerForm.card_type == 1) {
          let reg =
                  /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/;
          if (value === "") {
            callback(new Error("请填写身份证号码"));
          } else if (!reg.test(value)) {
            callback(new Error("身份证格式错误"));
          } else {
            callback();
          }
        } else if (this.registerForm.card_type == 2) {
          let reg = /^[A-Z,a-z,\d]+$/;
          if (value === "") {
            callback(new Error("请填写护照"));
          } else if (!reg.test(value)) {
            callback(new Error("护照格式错误"));
          } else {
            callback();
          }
        } else if (this.registerForm.card_type == 3) {
          let reg = /^[A-Z,a-z,\d]+$/;
          if (value === "") {
            callback(new Error("请填写港澳台胞证"));
          } else if (!reg.test(value)) {
            callback(new Error("证件格式错误"));
          } else {
            callback();
          }
        } else {
          callback();
        }
      };
      var phone_rule = (rule, value, callback) => {
        let phoneRule = /^1[23456789]\d{9}$/;
        if (value === "") {
          callback(new Error("请输入手机号码"));
        } else if (!phoneRule.test(value)) {
          callback(new Error("手机号码格式错误"));
        } else {
          callback();
        }
      };
      var email_rule = (rule, value, callback) => {
        let reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
        if (value === "") {
          callback(new Error("请填写电子邮箱"));
        } else if (!reg.test(value)) {
          callback(new Error("电子邮箱格式错误"));
        } else {
          callback();
        }
      };
      var province_rule = (rule, value, callback) => {
        console.log('工作区域参数', value);
        if (this.registerForm.province === "" || this.registerForm.province == null) {
          callback(new Error("请选择省份"));
        } else {
          callback();
        }
      };
      var last_py_rule = (rule, value, callback) => {
        let reg = /^[A-Z,a-z]+$/;
        if (value === "") {
          callback(new Error("请填写姓拼音"));
        } else if (!reg.test(value)) {
          callback(new Error("格式错误"));
        } else {
          callback();
        }
      };
      var first_py_rule = (rule, value, callback) => {
        let reg = /^[A-Z,a-z]+$/;
        if (value == "") {
          callback(new Error("请填写名拼音"));
        } else if (!reg.test(value)) {
          callback(new Error("格式错误"));
        } else {
          callback();
        }
      };
      var work_duty = (rule, value, callback) => {
        if (value === "") {
          callback(new Error("请填写职务"));
        } else {
          callback();
        }
      };
      var hig_edu = (rule, value, callback) => {
        if (value === "") {
          callback(new Error("请选择最高学历"));
        } else {
          callback();
        }
      };
      return {
        level:null,//科目级别
        isRegisterPass: false,
        org_name: '',
        isRegisterSpan: '（ 提示：请填写机构代码并确认培训机构 ）',
        isDisabled: false,
        course: null,
        flag: false, //是否满足报考条件
        certDisplayOptions: cert_list,
        work_dutyList: work_duty_list,
        ind_typeList: ind_typeList,
        com_typeList: com_typeList,
        hig_eduList: hig_eduList,
        isRegister: false, //确认阅读注册协议
        course_isShow: false,
        orgLock: false, //是否禁用机构输入框
        courseList: [], //科目集合
        areaOptions: areaData, //省市区三级联动
        selectedOptions: [], //选择后的省市区对象数组
        //预计考点城市
        exam_cityOptions: [],
        cardOptions: [
          {id: 1, name: "居民身份证"},
          {id: 2, name: "护照"},
          {id: 3, name: "港澳台胞身份证"},
        ],
        sex: {1: "m", 2: "f"},
        registerForm: {
          cert: null, //资质证书
          org_code: "", //机构
          course_id: "", //科目
          name: "", //学员姓名 --潘童
          last_py: "", //姓拼音
          first_py: "", //名拼音
          gender: "m", //性别
          card_type: 1, //证件类型
          birthday: "", //出生日期
          card_id: "", //证件号码 --320723199807023528
          phone: "", //手机号码 --18360556606
          email: "", //电子邮箱 --181501830@qq.com
          msg_code: "",
          major: "",//相关专业
          hig_edu: "", //最高学历
          grad_time: "", //毕业时间
          province: "", //省份 --江苏省
          city: "", //城市 --南京市
          region: "",//区 -- 万载县
          address: "", //居住地
          exam_city: "", //预计考点城市
          com_name: "", //单位名称 --爱柔则有限公司
          work_duty: "", //现有职务 --总经理助理
          buy_book: false, //是否购书
          sign: "", //电子签名
          agree: false, //是否同意培训合同
          work_age: 0, //工作年限
          ind_type: "", // 行业类型
          com_type: "" //单位类型
        },
        rules: {
          cert: [
            {required: true, message: "请选择资质证书", trigger: "change"},
          ],
          work_age: [
            {required: true, message: "请填写从业年限", trigger: "blur"},
          ],
          major: [
            {required: true, message: "请填写相关专业", trigger: "change"}
          ],
          grad_time: [
            {required: true, message: "请选择毕业年份", trigger: "change"},
          ],
          org_code: [
            {required: true, message: "请输入机构代码", trigger: "blur"},
          ],
          course_id: [
            {required: true, message: "请选择报读的级别", trigger: "change"},
          ],
          name: [{required: true, message: "请输入姓名", trigger: "blur"}],
          last_py: [{required: true, validator: last_py_rule, trigger: "blur"}],
          first_py: [
            {required: true, validator: first_py_rule, trigger: "blur"},
          ],
          card_type: [
            {required: true, message: "请选择证件类型", trigger: "blur"},
          ],
          card_id: [{required: true, validator: card_id_rule, trigger: "blur"}],
          birthday: [
            {required: true, message: "请选择出生日期", trigger: "change"},
          ],
          phone: [
            {
              required: true,
              validator: phone_rule,
              trigger: ["blur", "change"],
            },
          ],
          email: [{required: true, validator: email_rule, trigger: "blur"}],
          msg_code: [{required: true, message: "验证码不能为空", trigger: "blur"}],
          province: [
            {required: true, validator: province_rule, trigger: "change"},
          ],
          address: [{required: true, message: "请输入居住地", trigger: "blur"}],
          exam_city: [
            {required: true, message: "请选择考点城市", trigger: "change"},
          ],
          com_name: [
            {required: true, message: "请填写单位名称", trigger: "blur"},
          ],
          work_duty: [{required: true, validator: work_duty, trigger: "change"}],
          ind_type: [{required: true, message: "请选择行业类型", trigger: "change"}],
          com_type: [{required: true, message: "请选择单位类型", trigger: "change"}],
          buy_book: [
            {required: true, message: "请选择是否购买证书", trigger: "change"},
          ],
          hig_edu: [
            {required: true, validator: hig_edu, trigger: "change"},
          ],
        },
        value: "",
      }
    },
    created() {
      //获取档案表信息
      this.getProfile();
    },
    methods: {
      //报名返回主页
      goBack() {
        this.$router.push('/user')
      },
      toRegister() {
        this.isRegister = true
      },
      //报名提交表单
      SignUp(params) {

        sign_up(params).then(res => {
          console.log(res)
          this.$message({type: 'success', message: '报名成功'})
          this.$router.push('/user')
        }).catch(err => {
          this.flag = false
          this.$message({type: 'error', message: err.msg + err.errors})
        })
      },
      //获取实名认证后的信息
      getPersonCertInfo() {
        get_person_cert_info().then(res => {
          console.log('获取实名认证后的信息', res);
          this.registerForm.phone = res.person.mobile;
          this.registerForm.name = res.person.personName;
          this.registerForm.card_id = res.person.idCard;
          this.registerForm.gender = this.sex[res.person.sex];
          this.registerForm.address = res.person.address;
          this.registerForm.birthday = res.person.birthday;
        })
      },
      ReverseRankingDate(data, p) {
        for (let i = 0; i < data.length - 1; i++) {
          for (let j = 0; j < data.length - 1 - i; j++) {
            // console.log(Date.parse(data[j][p]));
            if (Date.parse(data[j][p]) > Date.parse(data[j + 1][p])) {
              var temp = data[j];
              data[j] = data[j + 1];
              data[j + 1] = temp;
            }
          }
        }
        return data;
      },
      //获取档案表信息
      getProfile() {
        profile().then(res => {
          console.log('档案表数据', res);
          if (res.length == 0) {
            this.getPersonCertInfo();
          } else {
            //报名信息赋值档案表最后一条
            let newProfile = this.ReverseRankingDate(res, "update_time");
            let currentData = JSON.parse(JSON.stringify(newProfile[newProfile.length - 1]));
            console.log('当前报名数据', currentData);
            this.registerForm = currentData;
            this.selectedOptions = textToCode([this.registerForm.province, this.registerForm.city, this.registerForm.region])
            console.log('赋值后的培训表单数据', this.registerForm)
          }
        }).catch(err => {
          this.$message({type: 'error', message: err.msg})
        })
      },
      //创建方法er
      DateDiffer(Date_end) {
        //date1结束时间
        let date1 = new Date(Date_end);
        //date2当前时间
        let date2 = new Date();
        date1 = new Date(date1.getFullYear(), date1.getMonth(), date1.getDate());
        date2 = new Date(date2.getFullYear(), date2.getMonth(), date2.getDate());
        const diff = date2.getTime() - date1.getTime(); //当前时间减去毕业时间
        const diffDate = diff / (24 * 60 * 60 * 1000 * 365); //计算当前时间与结束时间之间相差天数
        console.log("毕业天数", diffDate);
        return diffDate;
      },
      codeHandle() {
        if (this.$refs.isShow) {
          this.$refs.captcha.handleCode();
          this.isDisabled = true
        }
      },
      getCode(e) {
        console.log("获取验证码", e);
      },
      //查询机构
      getOrg() {
        getOrg({org_code: this.registerForm.org_code})
                .then((res) => {
                  let _this = this;
                  console.log("机构代码", res);
                  this.course = res.course;
                  let orgName = res.org_name;
                  this.org_name = res.org_name;
                  this.$confirm(`*您报读的机构名称为：【${orgName}】`, "提示", {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    type: "warning",
                  })
                          .then(() => {
                            this.$message({
                              type: "success",
                              message: "已提交",
                            });
                            _this.orgLock = true;
                            _this.courseList = res.course;
                            _this.course_isShow = true;
                          })
                          .catch(() => {
                            this.$message({
                              type: "info",
                              message: "已取消",
                            });
                          });
                })
                .catch((err) => {
                  this.$message({
                    type: "error",
                    message: err.msg,
                  });
                });
      },
      //获取省市区
      addressChange(arr) {
        [this.registerForm.province, this.registerForm.city, this.registerForm.region] = codeToText(arr);
      },
      //提交
      submitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            if (this.isRegisterPass) {
              if (this.flagFunction()) {
                this.registerForm.first_py = this.registerForm.first_py.toLocaleUpperCase()
                this.registerForm.last_py = this.registerForm.last_py.toLocaleUpperCase()
                this.registerForm.grad_time = this.registerForm.hig_edu.includes('在读') ? null:this.registerForm.grad_time
                console.log(this.registerForm.hig_edu);
                this.$delete(this.registerForm, 'course');
                console.log('报名表单', this.registerForm);
                this.SignUp(this.registerForm);
              } else {
                this.$message({
                  message: '您暂时不满足报名条件，详情查看国际薪税师官网',
                  type: "error",
                  duration: "5000"
                });
              }
            } else {
              this.$message({
                message: "请阅读并确认所提供的个人信息及材料真实、有效、合法。",
                type: "warning",
              });
              return false;
            }
          } else {
            this.$message({
              type: "warning",
              message: "请检查所有字段是否正确填写",
            });
            return false;
          }
        });
      },
      //重置
      resetForm() {
        // this.flagFunction();
        this.orgLock = false;
        this.courseList = [];
        // this.handleReset();
        this.$refs["registerForm"].resetFields();
      },
      //条件判断
      flagFunction() {
        let currentCourseName = this.course.filter((item) => item.id == this.registerForm.course_id)[0].name
        if(currentCourseName && currentCourseName.includes('一')){
          this.level = 1
        }else if(currentCourseName && currentCourseName.includes('二')){
          this.level = 2
        }else if(currentCourseName && currentCourseName.includes('三')){
          this.level = 3
        }
        return flagFilter(this.level,this.registerForm)
      },
    },
    computed: {
      course_name() {
        if (this.registerForm.course_id !== "") {
          let course_name = "";
          for (let item of this.courseList) {
            if (item.id == this.registerForm.course_id) {
              console.log(item);
              this.exam_cityOptions = item.examdate;
              course_name = item.name;
            }
          }
          return course_name;
        }
        return "";
      },
    },
    components: {
      headerComponent,
      footerComponent,
      TencentCaptcha,
      RegistertionAgreement
    }
  }
</script>

<style>
  .registerFormDiv .el-form-item__label {
    padding: 0px !important;
  }
</style>
<style scoped>
  .registerFormDiv .el-form-item {
    margin-bottom: 10px;
  }

  .registerFormDiv {
    margin-bottom: 100px;
    display: flex;
  }

  .inputWidth {
    width: 160px;
    margin-right: 20px;
  }

  .box-card {
    width: auto;
  }

  .user-register {
    width: 1200px;
    margin: 0 auto;
  }
</style>
